package com.qlshouyu.gateway.client.block.starter;

import com.qlshouyu.gateway.client.BgProperties;
import com.qlshouyu.gateway.client.Bootgateway;
import com.qlshouyu.gateway.client.BootgatewayInstance;
import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;

@Import(BgBlockProperties.class)
public class BgAutoconfiguration {


    @Bean
    public Bootgateway bootgateway() {
        return BootgatewayInstance.getBootgatewayClient();
    }

    @Bean
    public LoadBalancerBootgateway loadBalancerBootgateway(LoadBalancerClientFactory clientFactory, BgProperties properties, Bootgateway bootgateway) {
        return new LoadBalancerBootgateway(clientFactory, properties.getInstantce(), bootgateway);
    }

}
